/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package riteservices.services;

import java.util.List;
import riteservices.model.bean.Rating;
import riteservices.model.dao.RatingDAO;
import riteservices.util.Constantes;

/**
 *
 * @author sixviv
 */
public class RatingSrv {
    public RatingDAO rDAO = new RatingDAO();

    public String rateOwner(Rating rating){
        if(rDAO.add(rating)){
             return Constantes.TRUE_STR;
         }else{
             return Constantes.FALSE_STR;
         }
    }
    
    public String updateRate(Rating rating){
        if(rDAO.update(rating)){
             return Constantes.TRUE_STR;
         }else{
             return Constantes.FALSE_STR;
         }
    }

    public String replyPassengerRating(Rating rating){
         if(rDAO.update(rating)){
             return Constantes.TRUE_STR;
         }else{
             return Constantes.FALSE_STR;
         }
    }

    public Rating getById(int id){
        return rDAO.getRaitinById(id);
    }
    
    public List<Rating> getAllRegisters()
    {
        return rDAO.getAll(Rating.class);
    }

}
